package com.hxd.otc.module.wallet.presenter;

import android.support.annotation.NonNull;

import com.hxd.otc.base.BaseBean;
import com.hxd.otc.module.wallet.contract.OtcToNormalContact;
import com.hxd.otc.module.wallet.model.WalletModel;
import com.hxd.otc.mvp.base.BasePresenter;
import com.hxd.otc.net.BaseObserver;

import java.math.BigDecimal;

/**
 * Created by lzy on 2018/8/6 0006.
 * description ${添加钱包联系人 Presenter}
 */
public class OtcToNotmalAccountPresenter extends BasePresenter<OtcToNormalContact.View> implements OtcToNormalContact.Presenter {

    private final WalletModel mModel;


    public OtcToNotmalAccountPresenter(OtcToNormalContact.View view) {
        super(view);
        mModel = WalletModel.getInstance();
    }

    @Override
    public void start() {
    }


    @Override
    public void otcToNormalAccount(String... parameters) {
        mModel.otcToNormalAccount(new BaseObserver() {
            @Override
            public void onNext(@NonNull String msg, @NonNull Object o) {
                mView.onSuccess();
            }

            @Override
            public void onError(int errType, @NonNull String errMessage) {
                mView.showToast(errMessage);
                mView.onFail();
            }

        }, mView.<BaseBean>bindAutoDispose(), parameters);
    }

    @Override
    public void getAssetBySymbol(String symbol) {
        mModel.getAssetBySymbol(new BaseObserver<Double>() {
            @Override
            public void onNext(@NonNull String msg, @NonNull Double number) {

                mView.getAssetBySymbolSucced(number);
            }

            @Override
            public void onError(int errType, @NonNull String errMessage) {
                mView.getAssetBySymbolFail(errMessage);
            }


        }, mView.<BaseBean>bindAutoDispose(), symbol);
    }
}
